package com.jic.market.service;

import com.jic.common.base.vo.PageResult;
import com.jic.common.base.vo.RestResult;
import com.jic.market.PromotionUpdatePresellInfoRequest;
import com.jic.market.entity.PromotionMerchantProductEntity;
import com.jic.market.orm.Pagination;
import com.jic.market.request.*;
import com.jic.market.request.rest.PresellProductRequest;
import com.jic.market.response.*;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 促销商家商品服务
 * @author xuyongliang
 * @date 2020年01月16日
 */
public interface PromotionMerchantProductService {

    int deleteBatch(List<Long> ids);

    /**
     * 批量保存商品 list
     * @param productList
     * @return
     */
    Integer saveBatch(List<PromotionProductRequest> productList);

    /**
     * 批量保存商品V2 list
     * @param productList
     * @return
     */
    List<PromotionMerchantProductEntity> saveBatchV2(List<PromotionMerchantProductEntity> productList);


    /**
     * 查询促销商品列表
     * @param productCondition
     * @return
     */
    List<PromotionMerchantProductEntity> findOfPage(
            PromotionMerchantProductEntity productCondition,
            Pagination pagination);

    /**
     * 查询促销商品总数
     * @param productCondition
     * @return
     */
    Integer countOfPage(
            PromotionMerchantProductEntity productCondition);


    /**
     * 根据 promotionId 和 mpId 删除
     * @param promotionId
     * @param mpId
     * @return
     */
    Integer deleteEntityByPromotionIdAndMpId(Long promotionId, Long mpId);

    /**
     * 根据 promotionId 和 mpId 查找
     * @param promotionId
     * @param mpId
     * @return
     */
    PromotionMerchantProductEntity queryEntityByPromotionIdAndMpId(Long promotionId, Long mpId);

    /**
     * 根据 promotionId 和 mpId 更新
     * @param promotionId
     * @param mpId
     * @return
     */
    Integer updateEntityByPromotionIdAndMpId(BigDecimal promPrice, Long promotionId, Long mpId) ;

    void deleteProductBatch(List<Long> mpIds);

    /**
     * 根据促销id 和 mpId修改，更新状态互斥状态
     * @param promotionId
     * @param mpId
     * @param mutexFlag
     * @see com.jic.market.common.enums.MutexFlagEnum  是否与其他活动互斥
     * @param updateTime
     * @return
     */
    Integer updateCondition(Long promotionId, Long mpId, Integer mutexFlag, Date updateTime);

    /**
     * 根据主键id修改，更新值
     * @param pmpEntity
     * @see com.jic.market.common.enums.MutexFlagEnum  是否与其他活动互斥
     * @return
     */
    Integer updateEntity(PromotionMerchantProductEntity pmpEntity);

    Integer saveBatchV3(PromotionProductSaveBatchListRequest request);

    PageResponse<PromotionProductResponse> getProductList(PromotionMerchantProductRequest request);
    //删除商品 排除互斥
    Integer deleteProductV2(Long id);
    //删除商品 全部删除
    Integer deleteProductV3(Long id);

    Integer addAllProduct(PromotinAddAllProductRequest request);

    void deletProductByStoreIdsAndPromotionId(List<Long> storeIds, Long promotionId);

    Long skuCount(PromotionProductSkuCountRequest request);

    void updatePresellInfo(PromotionUpdatePresellInfoRequest request);

    RestResult<Map<String,Object>> renewAddMutexProduct(RenewAddMutexProductRequest renewAddMutexProductRequest);

    /**
    * @Autor: zhaowei
    * @Date: 2020/12/2 15:53
    * @Description: 根据商品查询预售活动
    */
    RestResult<PresellProductResponse> queryPresellByMpId(PresellProductRequest request);

    /**
    * @Autor: zhaowei
    * @Date: 2020/12/3 00:23
    * @Description: 查询促销聚合商品
    */
    RestResult<PromotionPolymericResponse> queryPromotionProduct(PromotionPolymericRequest request);

    /**
     *
     * @param request
     * @Description: 根据商品查询单一活动价格
     */
    RestResult<PromotionSingleProductResponse> querySingleByMpId(PromotionPolymericRequest request);

    /**
     *
     * @param mpIds
     * @Description: 根据多个商品id查询单一活动价格
     */
    RestResult<List<PromotionSingleProductResponse>> querySingleByMpIds(List<Long> mpIds);
}
